Skip to content

Conversation

@jdeniau
Copy link

@jdeniau jdeniau commented May 13, 2024

Q A
Branch? main
Bug fix? no
New feature? yes
Deprecations? no
Tickets N/A
License MIT
Doc PR N/A

Make the output of @Then the JSON node :node should have :count element(s) more explicit

Here the diff of the before / after output:

 - The element '2' is not equal to '1'
 + The JSON node "some.node" contains 2 elements (1 expected).

@Jean-Beru
Copy link
Collaborator

Good catch @jdeniau ! It seems that theJsonNodeShouldContain and theJsonNodeShouldNotContain methods also don't have an explicit message. Can you update them ?

@jdeniau
Copy link
Author

jdeniau commented Jun 4, 2024

Hi @Jean-Beru .

I created #33 for that 👍

Copy link
Collaborator

@Jean-Beru Jean-Beru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a unit test too ?

$this->assertSame(
$count,
$actualCount,
'The node "'.$node.'" contains '.$actualCount.' elements ('.$count.' expected).'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'The node "'.$node.'" contains '.$actualCount.' elements ('.$count.' expected).'
sprintf("The node '%s' contains %d elements, %d expected.", $node, $actualCount, $count)

$count,
$actualCount,
'The node "'.$node.'" contains '.$actualCount.' elements ('.$count.' expected).'
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a unit test too ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants